import React, { ComponentType, PropsWithChildren } from "react";
import { Navigate } from "react-router-dom";
type Props = {};

const H_login = (Com: ComponentType<object>) => {
  return (props: PropsWithChildren<object>) => {
    const token = localStorage.getItem("token");
    if (!token) {
      return <Navigate to={"/login2"}></Navigate>;
    } else {
      return <Com {...props}></Com>;
    }
  };
};

export default H_login;
